<?php

namespace login\view;

class AddUserView {

	private static $ADDUSER = "adduser";
	private static $USERNAME = "AddUserView::NewUserName";
	private static $PASSWORD = "AddUserView::NewPassword";
	private static $REPEATPASSWORD = "AddUserView::NewRepeatPassword";
	private static $REGISTER = "register";
	private static $CREATINGUSER = "adduser";
	private $inputValue = "";
	private $message = ""; 

	/**
	 * @return boolean
	 */
	public function isCreatingUser() {
		return isset($_GET[self::$REGISTER]);
	}

	public function creatingUsr() {
		return isset($_GET[self::$CREATINGUSER]);
	}

	public function getNewUserName() {
		return $_POST[self::$USERNAME];
	}

	public function getNewPassword() {
		return $_POST[self::$PASSWORD];
	}

	public function getRepeatPassword() {
		return $_POST[self::$REPEATPASSWORD];
	}

	public function setMessage($message) {
		$this->message = $message;
	}

	public function setInputValue() {
		$this->inputValue = $_POST[self::$USERNAME];
	}

	public function getAddUserPage() {
		$html = "
		<a href='?'>Tillbaka</a>
		<form action='?" . self::$ADDUSER . "' method='post'>
			<fieldset>
				<legend>Registrera</legend>
				<p>$this->message</p>
				<label for='NewUserNameID'>Namn: </label>
				<input type='text' size='20' name='" . self::$USERNAME . "' id='NewUserNameID' value='$this->inputValue' /><br />
				<label for='NewPasswordID' >Lösenord:</label>
				<input type='password' size='20' name='" . self::$PASSWORD . "' id='NewPasswordID' /><br />
				<label for='NewRepeatPasswordID' >Repetera Lösenord:</label>
				<input type='password' size='20' name='" . self::$REPEATPASSWORD . "' id='NewRepeatPasswordID' /><br />
				<input type='submit' name=''  value='Skicka' />
			</fieldset>
		</form>";

		return $html;
	}
}